package org.daochong.lang.session;

import org.daochong.lang.session.SessionContext;
import org.daochong.lang.session.SessionContextFactory;
import org.daochong.lang.uai.UniteAccessInterfaceFactory;

public class SessionContextFactoryBean extends SessionContextFactory {

	private SessionContext sessionContext;

	private UniteAccessInterfaceFactory uaiFactory;

	public SessionContextFactoryBean() {
		SessionContextFactoryBean.instance = this;
	}

	public UniteAccessInterfaceFactory getUaiFactory() {
		return uaiFactory;
	}

	public void setUaiFactory(UniteAccessInterfaceFactory uaiFactory) {
		this.uaiFactory = uaiFactory;
	}

	public SessionContext getSessionContext() {
		if (this.sessionContext == null && this.getUaiFactory() != null) {
			this.sessionContext = this.getUaiFactory().getTemplate(SessionContext.class);
		}
		return sessionContext;
	}

	public void setSessionContext(SessionContext sessionContext) {
		this.sessionContext = sessionContext;
	}

}
